-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add ucontext_t
and {get,set,make,swap}context
for powerpc64-linux
#3986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Related to #3964 |
I see there is an issue with the PR in regards to the usage of of c_double/float64. error[E0277]: the trait bound `f64: core::cmp::Eq` is not satisfied
--> src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:43:9
|
43 | pub fp_regs: [::c_double; 33], // # define __NFPREG 33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `core::cmp::Eq` is not implemented for `f64`, which is required by `[f64; 33]: core::cmp::Eq`
|
= help: the following other types implement trait `core::cmp::Eq`:
i128
i16
i32
i64
i8
isize
u128
u16
and 4 others
= note: required for `[f64; 33]` to implement `core::cmp::Eq`
note: required by a bound in `AssertParamIsEq`
--> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:359:1
= note: this error originates in the derive macro `Eq` which comes from the expansion of the macro `s` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `f64: Hash` is not satisfied
--> src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:43:9
|
43 | pub fp_regs: [::c_double; 33], // # define __NFPREG 33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Hash` is not implemented for `f64`, which is required by `[f64; 33]: Hash`
|
= help: the following other types implement trait `Hash`:
i128
i16
i32
i64
i8
isize
u128
u16
and 4 others
= note: required for `[f64; 33]` to implement `Hash`
= note: this error originates in the derive macro `Hash` which comes from the expansion of the macro `s` (in Nightly builds, run with -Z macro-backtrace for more info) @JohnTitor Would you know what I need to change to make this pass? I tried to adapt based on the aarch64, loongarch64 & riscv64 version with the help of the powerpc64 glibc ucontext header file but apparently something's going wrong! Any help is appreciated! |
@rustbot label stable-nominated |
I think this looks fine, but could you please add links to the relevant headers in the PR description? |
@rustbot author (just comment |
@tgross35 Thanks for looking into this! I updated the PR description with the relevant header files. |
☔ The latest upstream changes (presumably #4070) made this pull request unmergeable. Please resolve the merge conflicts. |
@mgiessing this will need a rebase since the |
I'm currently not having access to my laptop so the earliest I can work again on this will be mid of December, more probably beginning of next year :-) |
No worries! I'll mark this as a draft. Any chance you know the answer to https://github.com/rust-lang/libc/pull/3986/files#r1831808892? If so, maybe somebody could pick this up to finish it. |
Ah, although it is quite some time I believe I used ![]() https://refspecs.linuxbase.org/LSB_2.1.0/LSB-Core-PPC64/LSB-Core-PPC64.html |
Signed-off-by: mgiessing <[email protected]>
929b0f7
to
fabdf66
Compare
@tgross35 Sorry for late response but I finally rebased this PR and integrated everything into |
@tgross35 just checking in - have you had a chance to look into this PR when you get a moment? No rush if you're busy :-) |
#[allow(missing_debug_implementations)] | ||
#[repr(align(8))] | ||
pub struct mcontext_t { | ||
__glibc_reserved: [c_ulong; 4], | ||
pub signal: c_int, | ||
__pad0: c_int, | ||
pub handler: c_ulong, | ||
pub oldmask: c_ulong, | ||
pub regs: *mut pt_regs, | ||
pub gp_regs: [c_ulong; __NGREG], | ||
pub fp_regs: [c_double; __NFPREG], | ||
pub v_regs: *mut vrregset_t, | ||
pub vmx_reserve: [c_long; __NVRREG + __NVRREG + 1], | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a pub type gregset_t = [c_ulong; __NGREG]
and use it here, same for fp_regs.
Also is this supposed to have an align repr? I don't see that at https://github.com/bminor/glibc/blob/a6eb8285d9bfb7ec0875b85ca356e833ff964d4f/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h#L120-L150
#[allow(missing_debug_implementations)] | ||
pub struct pt_regs { | ||
pub gpr: [c_ulong; 32], | ||
pub nip: c_ulong, | ||
pub msr: c_ulong, | ||
pub orig_gpr3: c_ulong, | ||
pub ctr: c_ulong, | ||
pub link: c_ulong, | ||
pub xer: c_ulong, | ||
pub ccr: c_ulong, | ||
pub softe: c_ulong, | ||
pub trap: c_ulong, | ||
pub dar: c_ulong, | ||
pub dsisr: c_ulong, | ||
pub result: c_ulong, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the PR description with a permalink to the source in UAPI?
pub fn getcontext(ucp: *mut ucontext_t) -> c_int; | ||
pub fn setcontext(ucp: *const ucontext_t) -> c_int; | ||
pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: c_int, ...); | ||
pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> c_int; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the definitions at https://github.com/bminor/glibc/blob/a6eb8285d9bfb7ec0875b85ca356e833ff964d4f/stdlib/ucontext.h#L34-L52 right?
#[repr(align(8))] | ||
pub struct clone_args { | ||
pub flags: c_ulonglong, | ||
pub pidfd: c_ulonglong, | ||
pub child_tid: c_ulonglong, | ||
pub parent_tid: c_ulonglong, | ||
pub exit_signal: c_ulonglong, | ||
pub stack: c_ulonglong, | ||
pub stack_size: c_ulonglong, | ||
pub tls: c_ulonglong, | ||
pub set_tid: c_ulonglong, | ||
pub set_tid_size: c_ulonglong, | ||
pub cgroup: c_ulonglong, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ucontext_t
and {get,set,make,swap}context
for powerpc64-linux
ucontext_t
and {get,set,make,swap}context
for powerpc64-linuxucontext_t
and {get,set,make,swap}context
for powerpc64-linux
Description
This PR will add
ucontext_t
to powerpc64le-unknown-linux-gnu.The relevant header files this is linked to can be found here: https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h and for
ucontext_t
specifically here: https://github.com/bminor/glibc/blob/a6eb8285d9bfb7ec0875b85ca356e833ff964d4f/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h#L155-L196Sources
Checklist
libc-test/semver
have been updated*LAST
or*MAX
areincluded (see #3131)
cd libc-test && cargo test --target mytarget
);especially relevant for platforms that may not be checked in CI
Testing throws an error, but that is not related to this PR as far as I can see. Even without the patch I see an error in the main branch